#ifndef STATE_PATTERN_H
#define STATE_PATTERN_H

#include <string>

using namespace std;

class Context;

class State
{
public:
    virtual ~State() {}
    virtual void doAction(Context* context) = 0;
    virtual string toString() = 0;
};

class StartState : public State
{
public:
    ~StartState() {}

    void doAction(Context *context) override;
    string toString() override;
};

class StopState : public State
{
public:
    ~StopState() {}

    void doAction(Context *context) override;
    string toString() override;
};

class Context
{
public:
    Context();
    ~Context();

    void setState(State* state);
    State* getState();

private:
    State* state;
};

#endif // STATE_PATTERN_H

/*
    Context* context = new Context();

    StartState* startState = new StartState();
    startState->doAction(context);

    cout << context->getState()->toString() << endl;

    StopState* stopState = new StopState();
    stopState->doAction(context);

    cout << context->getState()->toString() << endl;
    */
